package cn.wolfcode.trip.base.mapper;

import cn.wolfcode.trip.base.domain.Commodity;
import cn.wolfcode.trip.base.query.QueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface CommodityMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Commodity record);

    Commodity selectByPrimaryKey(Long id);

    List<Commodity> selectAll();

    int updateByPrimaryKey(Commodity record);

    List<Commodity> selectForList(QueryObject queryObject);

    //维护商品和分类的关系
    void insertRelation(@Param("commodityId") Long commodityId, @Param("catalogId")Long catalogId);
    void updateRelation(@Param("commodityId") Long commodityId, @Param("catalogId")Long catalogId);
    void deleteRelation(Long commodityId);

    List<Commodity> addStock();

    Commodity selectByCommodityId(Long id); //得到商品的价格
}